<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <!--1、Head：标题、css-->
    <head th:replace="common/backstage_fragment::headOne(类型添加)"></head>

    <!--2、JS-->
    <div th:replace="common/backstage_fragment::myJsOne"></div>

    <!--3、内容-->
    <body style="background-color: #FFFFFF">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>分类：添加页面</legend>
            </fieldset>
            <div style="width: 400px; margin: auto; margin-top: 100px">
                <form class="layui-form" action="/after/typeAdd" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">分类名称</label>
                        <div class="layui-input-block mini">
                            <input type="text" name="typeName" lay-verify="title" autocomplete="off" placeholder="请输入：分类名称" class="layui-input" required>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
    </body>

    <!--4、添加分类，状态判断-->
    <script th:inline="javascript">
        layui.use('layer', function(){
            var layer = layui.layer;
            var typeMessage = [[${typeMessage}]];
            console.log(typeMessage);

            if(typeMessage == 'true'){
                layer.alert('添加分类：成功！！！', {
                    icon: 6,
                    title: "提示"
                });
            }else if(typeMessage == 'false'){
                layer.alert('添加分类：失败, 该分类已存在！！！', {
                    icon: 5,
                    title: "提示"
                });
            }else if(typeMessage === 'no'){
                layer.alert('添加分类：失败, 数据库异常', {
                    icon: 5,
                    title: "提示"
                });
            }
        });
    </script>

</html>